package com.whiteape.book.presenter;

import com.whiteape.book.contract.MediaCollectionContract;
import com.whiteape.book.core.manager.MediaStorageManager;
import com.whiteape.book.model.dto.CollectionMediaBean;
import com.whiteape.book.ui.base.RxPresenter;
import com.whiteape.book.utils.RxUtils;

import java.util.List;

import io.reactivex.disposables.Disposable;

public class MediaCollectionPresenter extends RxPresenter<MediaCollectionContract.View> implements MediaCollectionContract.Presenter{
    @Override
    public void refreshCollectionMedia(int mediaType) {
        Disposable disposable =
        MediaStorageManager.getInstance().getMediaListInRx(mediaType)
                .compose(RxUtils::toSimpleSingle)
                .subscribe(beans -> mView.finishRefresh(beans));


        addDisposable(disposable);
    }

    @Override
    public void createDownloadTask(CollectionMediaBean collectionMediaBean) {

    }

    @Override
    public void updateCollectionMedia(List<CollectionMediaBean> collectionMediaBeans) {

    }

    @Override
    public void loadRecommendMedia(String gender) {

    }
}

